Is there any way to detect if the user is in the process of installing
  app X?
The closest you'll get to this is by using a NotificationListenerService. 
From the docs:
A service that receives calls from the system when new notifications
  are posted or removed.
But considering this Service was recently added in API level 18 and your use case, you might consider using a BroadcastReceiver and listening for when android.intent.action.PACKAGE_ADDED and android.intent.action.PACKAGE_REMOVED are called. This way once an app is installed or removed, you can do what you want with the package name, like provide a link to the Play Store.
Here's an example:
BroadcastReceiver
public class PackageChangeReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        if (intent == null || intent.getData() == null) {
            return;
        }
        final String packageName = intent.getData().getSchemeSpecificPart();
        // Do something with the package name
    }
}
In your AndroidManifest
<receiver android:name="your_path_to.PackageChangeReceiver" >
    <intent-filter>
        <action android:name="android.intent.action.PACKAGE_ADDED" />
        <action android:name="android.intent.action.PACKAGE_REMOVED" />
        <data android:scheme="package" />
    </intent-filter>
</receiver>