Help with WordPress custom url rewriting?

Changing the rewrite rules does not affect how WordPress writes links (except for the standard links, to posts, archives, … and then only in simple cases). The rewrite rules only cover how incoming URLs are handled, you are responsible for writing the links in the new format. This is different from frameworks with more advanced routing systems, like Symfony.

This means that you should change the link you write:

<a href="https://wordpress.stackexchange.com/questions/9168/<?php echo"/data-page/data_id/' . 32; ?>">Data page test link</a>

(Using get_page_by_path() and then get_permalink() seems redundant to me, since you already know the permalink, no? You can wrap it in home_url() to get the full path.)

The rewrite rule should then look like this:

$newrules['data-page/data_id/([0-9]{1,})/?$'] = 'index.php?data_id=$matches[1]&pagename=data-page';

We add the pagename=data-page because otherwise WordPress doesn’t know what page to show. You currently have a page with the slug data-page and a custom template, but there are also other ways to solve this.

Also, you should not flush the rewrite rules on every init. Only do this when the rules change. If you write this as a plugin use the activation hook, otherwise just visit the Permalinks page to flush them.

The first part of your question is not really clear to me. I once answered how to let a single post have its own domain name, perhaps that can help you?